﻿using DAL.Base;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL.Base
{
  public  class FileBLL
    {
        private readonly FileDAL _fileDal;
        public FileBLL()
        {
            _fileDal = new FileDAL();
        }


        /// <summary>
        /// 存储文件
        /// </summary>
        /// <param name="insertList"></param>
        public bool SaveFile(List<FileModel> insertList)
        {
            if (insertList !=null && insertList.Count>0)
            {
                return _fileDal.SaveFile(insertList);
            } else
            {
                return false;
            }
        }

        /// <summary>
        /// 获取附件
        /// </summary>
        /// <param name="list">主键列表</param>
        /// <returns></returns>
        public IEnumerable<FileModel> GetFile(List<Guid> recIds)
        {
            return _fileDal.GetFiles(recIds);
        }

        /// <summary>
        /// 根据文件主键删除
        /// </summary>
        /// <param name="ids">文件的主键</param>
        public bool Delete(string[] ids)
        {
            return _fileDal.Delete(ids);
        }
    }
}
